<?php
include("check.php");
include("check2.php");
include_once("../function.php");
include_once("../class/system_class.php");



$ID=$_GET['ID'];
//$suser=getMemberbyID($_SESSION['ID']);
$ispay="#00DB00";
$nopay="#FFFF00";
$nore="#A3CDF8";
session_start();
$us=getBMemberby($ID);
$UserID=$us['userid'];
$NickName=$us['nickname'];
$UserName=$us['username'];
$uLevel=$us['ulevel'];
$narea1=$us['area1'];
$narea2=$us['area2'];
$yarea1=$us['yarea1'];
$usname=$us['username'];
$yarea2=$us['yarea2'];
$rname=$us['rname'];
$ul=ulevel($uLevel);
$jibie=$ul['lvname'];
if ($us['ispay']==0){
	$usispaycolor=$nopay;
}else{
	$usispaycolor=$ispay;
}
//A区
if ($p1=getFatherManbyFidAndTreeplaceBmember($ID,1)){
	$p1NickName="<a href='?ID=".$p1['id']."'>"."<font color=black>".$p1['nickname']."</font>"."</a>";
	$ul=ulevel($p1['ulevel']);
	$p1jibie=$ul['lvname'];
	$p1rname=$p1['rname'];
	$p1area1=$p1['area1'];
	$p1area2=$p1['area2'];
	$p1usname=$p1['username'];
	$p1ulevel=$p1['ulevel'];
	$p1yarea1=$p1['yarea1'];
	$p1yarea2=$p1['yarea2'];
	if ($p1['ispay']==0){
		$p1ispaycolor=$nopay;
	}else{
		$p1ispaycolor=$ispay;
	}
}else{
    if($suser['isbd']==2){
        $p1NickName="<a href='register.php?nickname=".$NickName."&tid=1'><font color=black>注册</font></a>";
    }else{
        $p1NickName="<font color=black>注册</font>";
    }

	$p1jibie="空位";
	$p1area1=0;
	$p1area2=0;
	$p1yarea1=0;
	$p1yarea2=0;
}
//AA区
if ($p11=getFatherManbyFidAndTreeplaceBmember($p1['id'],1)){
	$p11NickName="<a href='?ID=".$p11['id']."'>"."<font color=black>".$p11['nickname']."</font>"."</a>";
	$ul=ulevel($p11['ulevel']);
	$p11jibie=$ul['lvname'];
	$p11rname=$p11['rname'];
	$p11area1=$p11['area1'];
	$p11area2=$p11['area2'];
	$p11usname=$p11['username'];
	$p11ulevel=$p11['ulevel'];
	$p11yarea1=$p11['yarea1'];
	$p11yarea2=$p11['yarea2'];
	if ($p11['ispay']==0){
		$p11ispaycolor=$nopay;
	}else{
		$p11ispaycolor=$ispay;
	}
}else{
	if ($suser['isbd']!=2){
		$p11NickName="注册";
	}else{
		$p11NickName="<a href='register.php?nickname=".$p1['nickname']."&tid=1'><font color=black>注册</font></a>";
	}
	$p11jibie="空位";
	$p11area1=0;
	$p11area2=0;
	$p11yarea1=0;
	$p11yarea2=0;
}
//AB区
if ($p12=getFatherManbyFidAndTreeplaceBmember($p1['id'],2)){
	$p12NickName="<a href='?ID=".$p12['id']."'>"."<font color=black>".$p12['nickname']."</font>"."</a>";
	$ul=ulevel($p12['ulevel']);
	$p12jibie=$ul['lvname'];
	$p12rname=$p12['rname'];
	$p12area1=$p12['area1'];
	$p12usname=$p12['username'];
	$p12ulevel=$p12['ulevel'];
	$p12area2=$p12['area2'];
	$p12yarea1=$p12['yarea1'];
	$p12yarea2=$p12['yarea2'];
	if ($p12['ispay']==0){
		$p12ispaycolor=$nopay;
	}else{
		$p12ispaycolor=$ispay;
	}
}else{
	if ($suser['isbd']!=2){
		$p12NickName="注册";
	}else{
		$p12NickName="<a href='register.php?nickname=".$p1['nickname']."&tid=2'><font color=black>注册</font></a>";
	}
	$p12jibie="空位";
	$p12area1=0;
	$p12area2=0;
	$p12yarea1=0;
	$p12yarea2=0;
}
//B区
if ($p2=getFatherManbyFidAndTreeplaceBmember($ID,2)){
	$p2NickName="<a href='?ID=".$p2['id']."'>"."<font color=black>".$p2['nickname']."</font>"."</a>";
	$ul=ulevel($p2['ulevel']);
	$p2jibie=$ul['lvname'];
	$p2rname=$p2['rname'];
	$p2area1=$p2['area1'];
	$p2usname=$p2['username'];
	$p2ulevel=$p2['ulevel'];
	$p2area2=$p2['area2'];
	$p2yarea1=$p2['yarea1'];
	$p2yarea2=$p2['yarea2'];
	if ($p2['ispay']==0){
		$p2ispaycolor=$nopay;
	}else{
		$p2ispaycolor=$ispay;
	}
}else{
    if($suser['isbd']==2){
        $p2NickName="<a href='register.php?nickname=".$NickName."&tid=2'><font color=black>注册</font></a>";
    }else{
        $p2NickName="<font color=black>注册</font>";
    }
	$p2jibie="空位";
	$p2area1=0;
	$p2area2=0;
	$p2yarea1=0;
	$p2yarea2=0;
}
//BA区
if ($p21=getFatherManbyFidAndTreeplaceBmember($p2['id'],1)){
	$p21NickName="<a href='?ID=".$p21['id']."'>"."<font color=black>".$p21['nickname']."</font>"."</a>";
	$ul=ulevel($p21['ulevel']);
	$p21jibie=$ul['lvname'];
	$p21rname=$p21['rname'];
	$p21ulevel=$p21['ulevel'];
	$p21usname=$p21['username'];
	$p21area1=$p21['area1'];
	$p21area2=$p21['area2'];
	$p21yarea1=$p21['yarea1'];
	$p21yarea2=$p21['yarea2'];
	if ($p21['ispay']==0){
		$p21ispaycolor=$nopay;
	}else{
		$p21ispaycolor=$ispay;
	}
}else{
	if ($suser['isbd']!=2){
		$p21NickName="注册";
	}else{
		$p21NickName="<a href='register.php?nickname=".$p2['nickname']."&tid=1'><font color=black>注册</font></a>";
	}
	$p21jibie="空位";
	$p21area1=0;
	$p21area2=0;
	$p21yarea1=0;
	$p21yarea2=0;
}
//BB区
if ($p22=getFatherManbyFidAndTreeplaceBmember($p2['id'],2)){
	$p22NickName="<a href='?ID=".$p22['id']."'>"."<font color=black>".$p22['nickname']."</font>"."</a>";
	$ul=ulevel($p22['ulevel']);
	$p22jibie=$ul['lvname'];
	$p22rname=$p22['rname'];
	$p22ulevel=$p22['ulevel'];
	$p22usname=$p22['username'];
	$p22area1=$p22['area1'];
	$p22area2=$p22['area2'];
	$p22yarea1=$p22['yarea1'];
	$p22yarea2=$p22['yarea2'];
	if ($p22['ispay']==0){
		$p22ispaycolor=$nopay;
	}else{
		$p22ispaycolor=$ispay;
	}
}else{
	if ($suser['isbd']!=2){
		$p22NickName="注册";
	}else{
		$p22NickName="<a href='register.php?nickname=".$p2['nickname']."&tid=2'>注册</a>";
	}
	$p22jibie="空位";
	$p22area1=0;
	$p22area2=0;
	$p22yarea1=0;
	$p22yarea2=0;
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="css/table.css" rel="stylesheet" type="text/css">
	<link href="css/style.css" rel="stylesheet" type="text/css">
	<title>个人资料</title>
	<style type="text/css">
		a:link {
			text-decoration: none;
		}
		a:visited {
			text-decoration: none;
		}
		a:hover {
			text-decoration: none;
		}
		a:active {
			text-decoration: none;
		}

	</style>
</head>
<body>
<table  width="100%" height="600" cellpadding="3" cellspacing="1" border="0" align="center" >
	<form name="form1" method="post" action="?">
		<tr>
			<td height="22" colspan="3" class="ziti">查询会员：

				<input type="text" name="nickname" id="nickname">
				<input name="submin" type="submit" class="button_blue" id="submin" value="查  询">
				<?php
				if ($ID != $_SESSION['ID']){
					?>&nbsp;&nbsp;&nbsp;&nbsp;<a href="?ID=<?=$_SESSION['ID']?>">返回顶层</a> &nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:history.back(-1)">返回上一层</a>
					<?php
				}

				$id1=treepplace($_SESSION['ID'],1);
				$id2=treepplace($_SESSION['ID'],2);
				?>
				<a href="?ID=<?=$id1?>">A区最低层</a> &nbsp;&nbsp;&nbsp;&nbsp;<a  href="?ID=<?=$id2?>">B区最低层</a>
			</td>
			<td style="background:<?=$ispay?>" align="center" class="ziti" >已激活</td>
			<td style="background:<?=$nopay?>" align="center" class="ziti">未激活</td>
		</tr>
		<tr>
	</form>
	<td height="120" colspan="6" align="center">
		<?php
		$se=null;
		if($uLevel==1){
			$se = '#79FF79';
		}else if($uLevel==2){
			$se = '#2894FF';
		}else if($uLevel==3){
			$se = '#FF5151';
		}else if($uLevel==4){
			$se = '#FFD700';
		}else if($uLevel==5){
			$se = '#4b5cc4';
		}else if($uLevel==6){
			$se = '#4c8dae';
		}
		?>
		<table width="120" cellpadding="3" cellspacing="1" border="0" align="center" class="table1" >
			<tr>
				<td style="background:<?=$usispaycolor?>" colspan="2" align="center"><font color="black"><?=$NickName?></font></td>
			</tr>
			<tr>
				<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$usname?></td>
			</tr>
			<tr>
				<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$rname?></td>
			</tr>
			<tr>
				<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$jibie?></td>
			</tr>
			<tr>
				<td style="background-color: <?=$se?>" colspan="2" align="center" >总计</td>
			</tr>
			<tr>
				<td style="background-color: <?=$se?>" align="center"><?=$narea1?></td>
				<td style="background-color: <?=$se?>" align="center"><?=$narea2?></td>
			</tr>
			<tr>
				<td style="background-color: <?=$se?>" colspan="2" align="center" >结余</td>
			</tr>
			<tr>
				<td style="background-color: <?=$se?>" align="center"><?=$yarea1?></td>
				<td style="background-color: <?=$se?>" align="center"><?=$yarea2?></td>
			</tr>
		</table></td>
	</tr>
	<tr>
		<td height="36" colspan="6" align="center"><img src="images/t_tree_bottom_l.gif"  height="30"><img src="images/t_tree_line.gif" alt=""  width="280" height="30"><img src="images/t_tree_top.gif"  height="30"><img src="images/t_tree_line.gif" alt=""  width="280" height="30"><img src="images/t_tree_bottom_r.gif" height="30"></td>
	</tr>
	<tr>
		<td width="50%" height="103" colspan="2"  align="center">
			<?php
			$se=null;
			if($p1ulevel==1){
				$se = '#96FED1';
			}else if($p1ulevel==2){
				$se = '#4DFFFF';
			}else if($p1ulevel==3){
				$se = '#FF5151';
			}else if($p1ulevel==4){
				$se = '#FFD700';
			}else if($p1ulevel==5){
                $se = '#4b5cc4';
            }else if($p1ulevel==6){
                $se = '#4c8dae';
            }
			?>
			<table width="120" cellpadding="3" cellspacing="1" border="0" align="center" class="table1">
				<tr>
					<td style="background:<?=$p1ispaycolor?>; font-color:black;" colspan="2" align="center">
						<?=$p1NickName?>
					</td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$p1usname?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$p1rname?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$p1jibie?></td>
				</tr>
				<tr >
					<td style="background-color: <?=$se?>" colspan="2" align="center" >总计</td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" align="center"><?=$p1area1?></td>
					<td style="background-color: <?=$se?>" align="center"><?=$p1area2?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center" >结余</td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" align="center"><?=$p1yarea1?></td>
					<td style="background-color: <?=$se?>" align="center"><?=$p1yarea2?></td>
				</tr>
			</table></td>
		<td width="50%" colspan="4" align="center">
			<?php
			$se=null;
			if($p2ulevel==1){
				$se = '#96FED1';
			}else if($p2ulevel==2){
				$se = '#4DFFFF';
			}else if($p2ulevel==3){
				$se = '#FF5151';
			}else if($p2ulevel==4){
				$se = '#FFD700';
			}else if($p2ulevel==5){
                $se = '#4b5cc4';
            }else if($p2ulevel==6){
                $se = '#4c8dae';
            }
			?>
			<table width="120" cellpadding="3" cellspacing="1" border="0" align="center" class="table1">
				<tr>
					<td style="background:<?=$p2ispaycolor?>" colspan="2" align="center"><?=$p2NickName?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$p2usname?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$p2rname?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$p2jibie?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center" >总计</td>
				</tr>
				<tr >
					<td  style="background-color: <?=$se?>" align="center"><?=$p2area1?></td>
					<td  style="background-color: <?=$se?>" align="center"><?=$p2area2?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center" >结余</td>
				</tr>
				<tr>
					<td  style="background-color: <?=$se?>" align="center"><?=$p2yarea1?></td>
					<td  style="background-color: <?=$se?>" align="center"><?=$p2yarea2?></td>
				</tr>
			</table></td>
	</tr>
	<tr>
		<td height="36" colspan="2" align="center"><img src="images/t_tree_bottom_l.gif" alt=""  height="30"><img src="images/t_tree_line.gif" alt=""  width="120" height="30"><img src="images/t_tree_top.gif" alt=""  height="30"><img src="images/t_tree_line.gif" alt=""  width="120" height="30"><img src="images/t_tree_bottom_r.gif" alt="" height="30"></td>
		<td colspan="4" align="center"><img src="images/t_tree_bottom_l.gif" alt=""  height="30"><img src="images/t_tree_line.gif" alt=""  width="120" height="30"><img src="images/t_tree_top.gif" alt=""  height="30"><img src="images/t_tree_line.gif" alt=""  width="120" height="30"><img src="images/t_tree_bottom_r.gif" alt="" height="30"></td>
	</tr>
	<tr>
		<td align="center" valign="top">
			<?php
			$se=null;
			if($p11ulevel==1){
				$se = '#96FED1';
			}else if($p11ulevel==2){
				$se = '#4DFFFF';
			}else if($p11ulevel==3){
				$se = '#FF5151';
			}else if($p11ulevel==4){
				$se = '#FFD700';
			}else if($p11ulevel==5){
                $se = '#4b5cc4';
            }else if($p11ulevel==6){
                $se = '#4c8dae';
            }
			?>
			<table width="120" cellpadding="3" cellspacing="1" border="0" align="center" class="table1">
				<tr>
					<td style="background:<?=$p11ispaycolor?>" colspan="2" align="center"><?=$p11NickName?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$p11usname?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$p11rname?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>"  colspan="2" align="center"><?=$p11jibie?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center" >总计</td>
				</tr>
				<tr>
					<td  style="background-color: <?=$se?>" align="center"><?=$p11area1?></td>
					<td  style="background-color: <?=$se?>" align="center"><?=$p11area2?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center" >结余</td>
				</tr>
				<tr>
					<td  style="background-color: <?=$se?>" align="center"><?=$p11yarea1?></td>
					<td  style="background-color: <?=$se?>" align="center"><?=$p11yarea2?></td>
				</tr>
			</table></td>
		<td align="center" valign="top">
			<?php
			$se=null;
			if($p12ulevel==1){
				$se = '#96FED1';
			}else if($p12ulevel==2){
				$se = '#4DFFFF';
			}else if($p12ulevel==3){
				$se = '#FF5151';
			}else if($p12ulevel==4){
				$se = '#FFD700';
			}else if($p12ulevel==5){
                $se = '#4b5cc4';
            }else if($p12ulevel==6){
                $se = '#4c8dae';
            }
			?>
			<table width="120" cellpadding="3" cellspacing="1" border="0" align="center" class="table1">
				<tr>
					<td style="background:<?=$p12ispaycolor?>" colspan="2" align="center"><?=$p12NickName?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$p12usname?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$p12rname?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>"  colspan="2" align="center"><?=$p12jibie?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center" >总计</td>
				</tr>
				<tr>
					<td  style="background-color: <?=$se?>" align="center"><?=$p12area1?></td>
					<td  style="background-color: <?=$se?>" align="center"><?=$p12area2?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center" >结余</td>
				</tr>
				<tr>
					<td  style="background-color: <?=$se?>" align="center"><?=$p12yarea1?></td>
					<td  style="background-color: <?=$se?>" align="center"><?=$p12yarea2?></td>
				</tr>
			</table></td>
		<td align="center" valign="top">
			<?php
			$se=null;
			if($p21ulevel==1){
				$se = '#96FED1';
			}else if($p21ulevel==2){
				$se = '#4DFFFF';
			}else if($p21ulevel==3){
				$se = '#FF5151';
			}else if($p21ulevel==4){
				$se = '#FFD700';
			}else if($p21ulevel==5){
                $se = '#4b5cc4';
            }else if($p21ulevel==6){
                $se = '#4c8dae';
            }
			?>
			<table width="120" cellpadding="3" cellspacing="1" border="0" align="center" class="table1">
				<tr>
					<td style="background:<?=$p21ispaycolor?>" colspan="2" align="center"><?=$p21NickName?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$p21usname?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$p21rname?></td>
				</tr>
				<tr>
					<td  style="background-color: <?=$se?>" colspan="2" align="center"><?=$p21jibie?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center" >总计</td>
				</tr>
				<tr>
					<td  style="background-color: <?=$se?>" align="center"><?=$p21area1?></td>
					<td  style="background-color: <?=$se?>" align="center"><?=$p21area2?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center" >结余</td>
				</tr>
				<tr>
					<td  style="background-color: <?=$se?>" align="center"><?=$p21yarea1?></td>
					<td  style="background-color: <?=$se?>" align="center"><?=$p21yarea2?></td>
				</tr>
			</table></td>
		<td colspan="3" align="center" valign="top">
			<?php
			$se=null;
			if($p22ulevel==1){
				$se = '#96FED1';
			}else if($p22ulevel==2){
				$se = '#4DFFFF';
			}else if($p22ulevel==3){
				$se = '#FF5151';
			}else if($p22ulevel==4){
				$se = '#FFD700';
			}else if($p22ulevel==5){
                $se = '#4b5cc4';
            }else if($p22ulevel==6){
                $se = '#4c8dae';
            }
			?>
			<table width="120" cellpadding="3" cellspacing="1" border="0" align="center" class="table1">
				<tr>
					<td style="background:<?=$p22ispaycolor?>" colspan="2" align="center"><?=$p22NickName?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$p22usname?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$p22rname?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center"><?=$p22jibie?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center" >总计</td>
				</tr>
				<tr>
					<td  style="background-color: <?=$se?>" align="center"><?=$p22area1?></td>
					<td  style="background-color: <?=$se?>" align="center"><?=$p22area2?></td>
				</tr>
				<tr>
					<td style="background-color: <?=$se?>" colspan="2" align="center" >结余</td>
				</tr>
				<tr>
					<td  style="background-color: <?=$se?>" align="center"><?=$p22yarea1?></td>
					<td  style="background-color: <?=$se?>" align="center"><?=$p22yarea2?></td>
				</tr>
			</table></td>
	</tr>
</table>
</body>
</html>